<template>
    <div>
        <h3>欢迎  {{this.name}}</h3>
        <a href="#" @click="quit">注销登陆</a>
    </div>
</template>

<script>
import { getCookie, delCookie } from '@/assets/js/cookie.js'
export default {
    name: 'home',
    data() {
        return {
            name: ''
        }
    },
    mounted() {
        let unname = getCookie('username')
        this.name = unname
        if(unname == ''){
            this.$router.push('/login')
        }
    },
    methods: {
        quit(){
            delCookie('username')
            delCookie('password')
        }
    }
}
</script>

<style lang="stylus" scoped>
    h3
        font-size .36rem
        margin-bottom .2rem
</style>
